package com.momoauth.common.core.exception;

import com.momoauth.common.core.enumeration.ResultCodeEnum;
import lombok.Data;

@Data
public class GlobalException extends RuntimeException {

    private Integer code;

    public GlobalException(Integer code, String msg) {
        super(msg);
        this.code = code;
    }

    public GlobalException(ResultCodeEnum codeEnum){
        super(codeEnum.getMsg());
        this.code = codeEnum.getCode();
    }

    @Override
    public String toString() {
        return "GlobalException{" + "code=" + code + ", msg=" + this.getMessage() + '}';
    }
}
